﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SurveyTrackerV2.Admin.Controls
{
    public partial class SearchEmail : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SurveyTrackerV2DB db = new SurveyTrackerV2DB();
            
            var results =   from r in db.Emails
                            where r.EmailAddress.Contains(txtEmail.Text)

                  select new
                  {
                      emailId = r.EmailId,
                      emailAddress = r.EmailAddress
                  };
                            
            grdResults.DataSource = results;
            grdResults.DataBind();
        }
    }
}